<?php
/**
 * Created by PhpStorm.
 * User: JackWang
 * Date: 2022/4/27
 * Time: 14:53
 */
require "../vendor/autoload.php";

use Faker\Factory;

function test()
{
    $fake = Factory::create("zh_cn");
//    $fake = Factory::create();
    echo $fake->name.PHP_EOL;
    echo $fake->email.PHP_EOL;
    echo $fake->city.PHP_EOL;
    echo $fake->company.PHP_EOL;
    echo $fake->chrome.PHP_EOL;
    echo $fake->password.PHP_EOL;
    echo $fake->userAgent.PHP_EOL;
    echo $fake->word().PHP_EOL;
    echo $fake->dateTime->format('c').PHP_EOL;
}

trait Foo {
    function foo() {
        return $this->doFoo();
    }

    abstract function doFoo();
}

$double = Mockery::mock(Foo::class);
$double->allows()->doFoo()->andReturns(123);
echo $double->foo(); // int(123)